import QtQuick
import QtQuick.Controls

Window {
    id: root
    objectName: "window"
    width: 320
    height: 480
    visible: true
//    title: qsTr("Hello World")
//    color: "#f2f2f2"


    SwipeView {
        anchors.fill: parent

        AppPage {
            objectName: "app-page-zhihu"
            path: "qrc:/Resource/pageZhihu/"
        }

        AppPage {
            objectName: "app-page-haluo"
            path: "qrc:/Resource/pageHaluo/"
        }

        AppPage {
            objectName: "app-page-list"
            path: "qrc:/Resource/pageZhihu/"
            sourceComponent: ListView {
                id: listView
//                spacing: 10
                model: 1000
                clip: true
                delegate: Item {
                    width: listView.width
                    height: width / 4
                    Rectangle {
                        anchors.fill: parent
                        anchors.margins: 3
                        color: "white"
                        border.width: 1
                        Text {
                            anchors.centerIn: parent
                            text: "Index:" + index
                        }
                    }
                }

                Text {
                    text: "contentY:" + listView.contentY
                }
            }
        }

        AppPage {
            objectName: "app-page-grid"
            path: "qrc:/Resource/pageZhihu/"
            sourceComponent: GridView {
                id: gridView
                model: 1000
                clip: true
                cellWidth: width / 4
                cellHeight: cellWidth
                delegate: Item {
                    width: gridView.cellWidth
                    height:  gridView.cellWidth
                    Rectangle {
                        anchors.fill: parent
                        anchors.margins: 3
                        color: "white"
                        border.width: 1

                        Text {
                            anchors.centerIn: parent
                            text: "Index:" + index
                        }
                    }
                }

                Text {
                    text: "contentY:" + gridView.contentY.toFixed(0)
                }
            }
        }
    }

    Row {
        anchors.horizontalCenter: parent.horizontalCenter
        Button {
            text: "长截图"
            onClicked: timer.start()

            Timer {
                id: timer
                interval: 500
                onTriggered: {
                    CLongScreenShot.start();
    //                        startLongScreenShot()
                }
            }
        }

        Shortcut {
            sequence: "Ctrl+W"
            onActivated: CLongScreenShot.start(root);
        }
    }

    DebugWindow{}
}
